using System;
using System.Collections.Generic;
using System.Text;
using Widgetsphere.GeneratorEngine;

namespace Omniture.API.Generators.Objects
{
	internal class EvarRuntimeItemTemplate : BaseTemplate
	{
		internal EvarRuntimeItemTemplate(OmnitureProject project)
			: base(project)
		{
		}

		public override string FileContent
		{
			get
			{
				var sb = new StringBuilder();
				sb.AppendLine("using System;");
				sb.AppendLine("using System.Collections.Generic;");
				sb.AppendLine("using System.Text;");
				sb.AppendLine();
				sb.AppendLine("namespace Omniture.Plugin");
				sb.AppendLine("{");
				sb.AppendLine("	[Serializable()]");
				sb.AppendLine("	internal class EvarRuntimeItem");
				sb.AppendLine("	{");
				sb.AppendLine("		#region Class Members");
				sb.AppendLine();
				sb.AppendLine("		private string _name = string.Empty;");
				sb.AppendLine("		private string _value = string.Empty;");
				sb.AppendLine("		private bool _isRequired = false;");
				sb.AppendLine("		private bool _isSet = false;");
				sb.AppendLine();
				sb.AppendLine("		#endregion");
				sb.AppendLine();
				sb.AppendLine("		#region Constructors");
				sb.AppendLine();
				sb.AppendLine("		internal EvarRuntimeItem(string name, string value, bool isRequired)");
				sb.AppendLine("		{");
				sb.AppendLine("			_name = name;");
				sb.AppendLine("			_value = value;");
				sb.AppendLine("			_isRequired = isRequired;");
				sb.AppendLine("		}");
				sb.AppendLine();
				sb.AppendLine("		#endregion");
				sb.AppendLine();
				sb.AppendLine("		#region Property Implementations");
				sb.AppendLine();
				sb.AppendLine("		public string Name");
				sb.AppendLine("		{");
				sb.AppendLine("			get { return _name; }");
				sb.AppendLine("		}");
				sb.AppendLine();
				sb.AppendLine("		public string Value");
				sb.AppendLine("		{");
				sb.AppendLine("			get { return _value; }");
				sb.AppendLine("			set");
				sb.AppendLine("			{");
				sb.AppendLine("				_value = value;");
				sb.AppendLine("				_isSet = true;");
				sb.AppendLine("			}");
				sb.AppendLine("		}");
				sb.AppendLine();
				sb.AppendLine("		public bool IsRequired");
				sb.AppendLine("		{");
				sb.AppendLine("			get { return _isRequired; }");
				sb.AppendLine("		}");
				sb.AppendLine();
				sb.AppendLine("		public bool IsSet");
				sb.AppendLine("		{");
				sb.AppendLine("			get { return _isSet; }");
				sb.AppendLine("		}");
				sb.AppendLine();
				sb.AppendLine("		#endregion");
				sb.AppendLine();
				sb.AppendLine("	}");
				sb.AppendLine("}");
				return sb.ToString();
			}
		}

		public static void Generate(OmnitureProject project, string destinationFolder)
		{
			EvarRuntimeItemTemplate t = new EvarRuntimeItemTemplate(project);
			t.Generate(destinationFolder);
		}

		public override string FileName
		{
			get { return @"EvarRuntimeItem.cs"; }
		}

	}
}
